/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2024-03-21 13:59:44
 * @LastEditors: YangJianFei
 * @LastEditTime: 2024-08-15 16:47:52
 * @FilePath: /yt_deveop_app/lib/pages/mine/system_set/security/security_view.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/app_bar/app_bar_widget.dart';
import 'package:yt_devops/components/app_permission/permission_widget.dart';
import 'package:yt_devops/components/gaps.dart';
import 'package:yt_devops/resources/resources.dart';
import 'package:yt_devops/resources/str_res_keys.dart';
import 'package:yt_devops/styles/styles.dart';
import 'package:yt_devops/utils/constants/permission_page_constant.dart';
import 'security_controller.dart';

class SecurityPage extends GetView<SecurityController> {
  const SecurityPage({Key? key}) : super(key: key);

  List<String> get list => [
        ResKey.changePassword.tr,
        ResKey.accountCancellation.tr,
      ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBarWidget.defaultAppBar(ResKey.accountSecurity.tr),
      body:Container(
        height: 116,
        alignment: Alignment.center,
        clipBehavior: Clip.hardEdge,
        margin: const EdgeInsets.only(left: 16, right: 16,top: 10),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8),
          color: Colors.white,
        ),
        child:  Column(children: [
          ...list
              .mapIndexed(
                (index, item) => PermissionWidget(
              permissionStringList: [
                index == 0
                    ? PermissionConstant.mineSystemSettingAccountChangePwd
                    : PermissionConstant.mineSystemSettingAccountCancellation
              ],
              child: Container(
                color: Colour.white,
                margin: const EdgeInsets.only(top: 1),
                child: ListTile(
                  onTap: () => controller.toNextPage(index),
                  shape: const UnderlineInputBorder(
                      borderSide: BorderSide(color: Colour.dividerColor)),
                  minLeadingWidth: 0,
                  title: Text(
                    item,
                    style: TextStyles.f16,
                  ),
                  trailing: Image.asset(ImageAssets.rightArrow),
                ),
              ),
            ),
          )
              .toList(),
        ]),
      ),
    );
  }
}
